<?php

class Service_SessionModel {

    private $_sessionDao;

    public function __construct ()
    {
        $this->_sessionDao = new Dao_SessionModel();
    }

    public function addSession ($uid , $sessionid)
    {
        if ( ! $uid || ! $sessionid ){
            return false;
        }

        $info = $this->_sessionDao->get ( $uid , $sessionid );
        if ( $info )
        {
            $res = $this->_sessionDao->editSession ( $uid , $sessionid );
        }
        else
        {
            $data = array (
                'ss_uid'     => $uid ,
                'ss_session' => $sessionid ,
            );
            $res = $this->_sessionDao->addSession ( $data );
        }
        return $res ? $res : false;
    }

    public function getLoginval ($uid , $sid)
    {
        $info = $this->_sessionDao->get ( $uid , $sid );
        return $info ? true : false;
    }

}
